package com.xiaoshuidi.cloud.module.rooms.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @Author Feng
 * @date 2023/5/11
 */
@Getter
@AllArgsConstructor
public enum ReservationConfigTypeEnum {
    FIXED("1", "固定金额"),
    PROPORTION("2", "按租金比例");

    private String code;
    private String value;

    public static String getValue(String code) {
        ReservationConfigTypeEnum first = Arrays.stream(ReservationConfigTypeEnum.values()).filter(s -> code.equals(s.getCode())).findFirst().orElse(null);
        if (first == null) {
            return "";
        }
        return first.getValue();
    }
}
